<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改预算')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-budget-edit" th:object="${finBudget}">
        <input name="budgetId" th:field="*{budgetId}" type="hidden">
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">用户管理：</label>
                <div class="col-sm-8">
                    <span th:text="${userString}"></span>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">收支类别：</label>
                <div class="col-sm-8">
                    <select id="categoryId" name="categoryId" class="form-control" required>
                        <option value="">-- 请选择收支类别--</option>
                        <option th:each="category : ${categories}"
                                th:value="${category.categoryId}"
                                th:text="${category.categoryId + ' (' + category.categoryName + ')'}">
                        </option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">预算金额：</label>
                <div class="col-sm-8">
                    <input name="budgetAmount" th:field="*{budgetAmount}" class="form-control" type="text" required>
                </div>
            </div>
        </div>
        <div class="col-xs-12">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">预算月份：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="budgetMonth" th:value="${#dates.format(finBudget.budgetMonth, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
    var prefix = ctx + "system/budget";
    $("#form-budget-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-budget-edit').serialize());
        }
    }

    $("input[name='budgetMonth']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>